package com.chenjiahao.kaiyanwan.ui.hot

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.chenjiahao.kaiyanwan.logic.dao.Repository
import com.hazz.kotlinmvp.mvp.model.bean.HomeBean

/**
 * Created by chenjh on 2020/9/18
 */
class RankViewModel : ViewModel() {
    var itemList = ArrayList<HomeBean.Issue.Item>()

    private var nextPageUrlLiveData = MutableLiveData<String>()

    var rankNextPageUrl: String? = null

    val getIssueData = Transformations.switchMap(nextPageUrlLiveData) {
        Repository.getIssueData(it)
    }

    fun requestRankData() {
        nextPageUrlLiveData.value = rankNextPageUrl
    }
}